package ModelLayer.OrdreMappe;
import ModelLayer.LagerMappe.*;
import ModelLayer.PersonMappe.*;
import java.util.*;
import java.text.DateFormat;


public class Ordre
{
    private ArrayList<Delordre> delOrdre;
    private Kunde kunde;
    private Ansat ansat;
    private String dato;
    private String status;
    private int nr;
    private String datoForBetaling;
    private double pris;
    private String ordreType;
    
    /**
     * Constructor for objects of class OrdreCon
     */
    public Ordre(int nr)
    {
        delOrdre = new ArrayList<Delordre>();
        dato = DateFormat.getInstance().format(new Date());
        status = "Oprettet";
        this.nr = nr;
        datoForBetaling = null;
        pris = 0;
        this.ordreType = "Bestilling";
        
        kunde = null;
        ansat = null;
    }
    
    public String getDato()
    {
        return dato;
    }
    
    public void setDato(String newDato)
    {
        dato = newDato;
    }
    
    public String getStatus()
    {
        return status;
    }
    
    public void setStatus(String newStatus)
    {
       status = newStatus;
    }
    
    public int getNr()
    {
        return nr;
    }
    
    public void setNr(int newNr)
    {
        nr = newNr;
    }
    
    public String getDatoForBetaling()
    {
        return datoForBetaling;
    }
    
    public void setDatoForBetaling(String newDatoForBetaling)
    {
        newDatoForBetaling = datoForBetaling;
    }
    
    public double getPris()
    {
        return pris;
    }
    
    public void setPris(double newPris)
    {
        pris = newPris;
    }
    
    public String getOrdreType()
    {
        return ordreType;
    }
    
    public void setOrdreType(String newOrdreType)
    {
        ordreType = newOrdreType;
    }
    
    public void addVare(int antal, Lager lager, DelLager delLager)
    {
        delOrdre.add(new Delordre(antal, lager, delLager));
    }
    
    public ArrayList<Delordre> getAlleDelordre()
    {
        return delOrdre;
    }
    
    public void addPerson(Person p)
    {
        if(p.getPersonType().equals("Ansat"))
        {
            ansat = (Ansat)p;
        }
        else  if(p.getPersonType().equals("Kunde"))
        {
            kunde = (Kunde)p;
        }
        else if(p.getPersonType().equals("Erhvervskunde"))
        {
            kunde = (Erhvervskunde)p;
        }
    }
    
    public Kunde getKunde()
    {
        return kunde;
    }
    
    public Ansat getAnsat()
    {
        return ansat;
    }
}